package ben.samplegame.swing;

import ben.samplegame.engine.GravishotController;
import game.engine.GameController;
import game.userinteraction.UserInputHandler;
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JFrame;


/**
 * 
 * @author rwb392
 * 
 */
@SuppressWarnings("serial")
public class GameFrame extends JFrame {

    private int myWidth = 600;
    private int myHeight = 600;
    private UserInputHandler myInputHandler;

    /**
     * Constructor
     * @throws SecurityException Exception.
     * @throws NoSuchMethodException Exception.
     */
    public GameFrame () throws SecurityException, NoSuchMethodException {
        myInputHandler = new UserInputHandler();
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());
        setSize(myWidth, myHeight);
        setTitle("SampleGame");
        GameController myGame = new GravishotController(myInputHandler);
        add(myGame, BorderLayout.CENTER);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        setVisible(true);
        setResizable(false);
        myGame.startGame();
        this.addKeyListener(myInputHandler);
    }

}
